#!/bin/sh -efu

gear_rules_copy_simple_common()
{
	local spec=file.spec
	local n=foo
	local v=1
	local r=2
	local name=file
	local rule; rule="$1"; shift

	printf 'Name:%s\nVersion: %s\nRelease:	%s' "$n" "$v" "$r" >"$spec"
	printf '%s\n' "$rule" >.gear-rules
	echo "test $gear_directive" >$name
	git add "$spec" .gear-rules $name
	git commit -q -a -m 1

	finalize_repo

	$GEAR "$GEAR_OUT"
	check_pkgtar_list "$spec
./
./$spec
./$name$compress_suffix"
	check_pkgtar_spec "$GEAR_OUT" "$spec"
	unpack_pkgtar_to .out
	result="$($decompress_prog ".out/$name$compress_suffix")"
	assertEquals "test $gear_directive" "$result"
}

gear_rules_copy_simple() # test entry point
{
	gear_rules_copy_simple_common "$gear_directive: file"
}

gear_rules_copy_compress_simple() # test entry point
{
	gear_rules_copy_simple_common "compress: type=$gear_directive -- file"
}
